package org.deltaset.secured.example;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;

/**
 *
 * @author dmakariev
 */
@Entity
public class BidirectParent extends AbstractParent<BidirectParent,BidirectChild>{
    
    @OneToMany( fetch = FetchType.EAGER, mappedBy="parent")
    private Set<BidirectChild> children;

    @Override
    public Set<BidirectChild> getChildren() {
        if(null==children){
            children = new HashSet<BidirectChild>();
        }
        return children;
    }

    @Override
    public BidirectChild newChild(String childName) {
        return new BidirectChild(childName);
    }

    @Override
    public BidirectParent addNumberOfChildren(int numberOfChildren) {
        return super.addChildren(numberOfChildren);
    }


    
}
